<template>
  <view class="new_card" :style="viewColor">
    <image class="n_img" v-if="item?.image" :src="item?.image" mode="aspectFill"></image>
    <view class="title u-line-2">{{ item?.name || item?.title }}</view>
    <view class="n_xew">新人价</view>
    <view class="h_price">
      <view class="h_prices"><text>￥</text>{{ item?.after_price || 0.0 }}</view>
      <view class="h_price_s" v-if="parseFloat(Number(item?.ot_price)) != item.after_price"
        ><text>￥</text>{{ Number(item?.ot_price) || 0.0 }}</view
      >
    </view>
  </view>
</template>

<script>
import easyLoadimage from '@/components/easy-loadimage/easy-loadimage.vue'
// import {mapGetters} from "vuex";
export default {
  components: {
    easyLoadimage,
  },
  // computed: mapGetters(['viewColor']),
  props: {
    item: {
      type: Object,
      require: true,
    },
    type: {
      type: Number,
      default: 0,
    },
    isStore: {
      type: [String, Number],
      default: '1',
    },
    isLogin: {
      type: Boolean,
      require: false,
    },
    types: {
      type: String,
      default: '',
    },
  },
  data() {
    return {
      viewColor:
        '--view-theme: #E93323;--view-assist:#FF7612;--view-priceColor:#E93323;--view-bgColor:rgba(255, 118, 18,.1);--view-minorColor:rgba(233, 51, 35,.1);--view-bntColor11:#FDA923;--view-bntColor12:#FD6523;--view-bntColor21:#F11B09;--view-bntColor22:#F67A38;',
    }
  },
  mounted() {},
  methods: {
    goShop(id) {
      this.$emit('goShop', id)
    },
    authOpen() {
      this.$emit('authOpen')
    },
    followToggle(item) {
      this.$emit('followToggle', item)
    },
    changeArr(arr) {
      let newArr = []
      for (let i = 0; i < arr.length; i++) {
        if (arr[i].length >= 4) {
          newArr.push(arr[i])
        } else if (arr[i].length <= 2) {
          newArr.push(arr[i])
        } else if (4 >= arr[i].length >= 2) {
          newArr.push(arr[i])
        }
        if (newArr.length == 2) {
          return newArr
        }
      }
    },
  },
}
</script>

<style lang="scss" scoped>
@import '@/styles/shop.scss';
.new_card {
  width: 340rpx;
  background-color: #fff;
  border-radius: 10rpx;
  padding-bottom: 20rpx;
  overflow: hidden;
  .n_img {
    width: 340rpx;
    height: 340rpx;
  }
  .title {
    margin: 10rpx 0;
    padding: 0 18rpx;
    font-weight: 500;
    font-size: 26rpx;
    color: #000000;
    height: 72rpx;
    line-height: 36rpx;
  }
  .n_xew {
    width: 114rpx;
    height: 60rpx;
    background: url('/static/images/xinrenjia.png') no-repeat;
    background-size: 100% 100%;
    text-align: center;
    box-sizing: border-box;
    padding-left: 16rpx;
    padding-top: 8rpx;
    margin-left: 18rpx;
    line-height: 57rpx;
    font-family: PingFang SC, PingFang SC;
    font-weight: 800;
    font-size: 22rpx;
    color: #ffffff;
  }
  .h_price {
    display: flex;
    align-items: center;
    padding: 0 18rpx;
    margin-top: 8rpx;
    .h_prices {
      font-family: PingFang SC, PingFang SC;
      font-weight: 800;
      font-size: 36rpx;
      color: #da180a;
      line-height: 50rpx;
      text {
        font-size: 28rpx;
        margin-top: 5rpx;
      }
    }
    .h_price_s {
      font-family: PingFang SC, PingFang SC;
      font-weight: 500;
      font-size: 24rpx;
      color: #999999;
      line-height: 50rpx;
      margin-top: 5rpx;
      margin-left: 5rpx;
      text-decoration: line-through;
    }
  }
}
</style>
